//@dart=2.12
import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:ls_work/bad_event/bad_event_ext.dart';
import 'package:ls_work/res/colors.dart';
import 'package:ls_work/res/gaps.dart';
import 'package:ls_work/util/ext_utils.dart';
import 'package:ls_work/widgets/common_widget.dart';

import '../../widgets/event_input_widget.dart';
import '../view_model/create_bad_event_view_model.dart';
import 'bad_event_list_page.dart';

class ElderFallEventPage extends BaseStatefulMvvmWidget {
  dynamic eventId;
  dynamic eventType;
  ElderFallEventPage({this.eventId,this.eventType});

  @override
  State<StatefulWidget> createState() => _ElderFallEventState();
}

class _ElderFallEventState
    extends BaseMvvmState<CreateBadEventViewModel, ElderFallEventPage> {
  @override
  Widget buildLoadingContentView() {
    var detail = viewModel.eventDetail;
    if(detail?.eventType==1){
      return elderFallWidget();
    }

    if(detail?.eventType==4||detail?.eventType==5){
      return medicineEventWidget();
    }

    return Container();
  }

  Widget elderFallWidget(){
    var detail = viewModel.eventDetail;
    return SingleChildScrollView(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          SizedBox(
            height: 8,
          ),
          Column(
            children: [
              TitleValueWidget(
                  title: '长者姓名',
                  value: detail?.customerName ?? "",
                  hint: '请选择',
                  isRequired: true,
                  contentWeight: -1,
                  arrow: arrowRight)
                  .onTap(() {
                viewModel.chooseElder();
              }),
              TitleValueWidget(
                title: '床位号',
                value: detail?.bedNo ?? "",
                hint: '根据老人自动显示',
                contentWeight: -1,
              ),
              TitleValueWidget(
                title: '性别',
                value: detail?.sexName ?? "",
                hint: '根据老人自动显示',
                contentWeight: -1,
              ),
              TitleValueWidget(
                  title: '发生时间',
                  value: detail?.occurrenceTime ?? "",
                  hint: '请选择',
                  contentWeight: -1,
                  isRequired: true,
                  arrow: arrowRight)
                  .onTap(() {
                viewModel.chooseOccurrenceTime();
              }),
              TitleValueWidget(
                  title: '事发时意识状态',
                  value:
                  detail?.qualityAnomalousEvent?.consciousState ?? "",
                  hint: '请选择',
                  contentWeight: -1,
                  isRequired: true,
                  arrow: arrowRight)
                  .onTap(() {
                viewModel.chooseConsciousState();
              }),
              Column(
                children: [
                  TitleValueWidget(
                      title: '入住时是否为跌倒危险群',
                      value: detail?.qualityAnomalousEvent?.falldownHighRish
                          .yesOrNo,
                      hint: '请选择',
                      contentWeight: -1,
                      arrow: arrowRight)
                      .onTap(() {
                    viewModel.chooseYesOrNo(
                        detail?.qualityAnomalousEvent?.falldownHighRish,
                            (value) {
                          setState(() {
                            detail?.qualityAnomalousEvent?.falldownHighRish = value;
                          });
                        });
                  }),
                  if (detail?.qualityAnomalousEvent?.falldownHighRish == 1) ...[
                    NoBorderInput(
                        text: detail?.qualityAnomalousEvent?.screenItem ?? "",
                        hintText: '请输入',
                        onChanged: (str) {
                          detail?.qualityAnomalousEvent?.screenItem = str;
                        })
                        .addToContainer(
                        width: double.infinity,
                        decoration: BoxDecoration(
                            color: Color(0xfff7f7f7),
                            borderRadius: 3.borderRadius),
                        padding: EdgeInsets.symmetric(
                            horizontal: 16, vertical: 12)),
                    SizedBox(
                      height: 14,
                    )
                  ]
                ],
              ),
              TitleValueWidget(
                  title: '长者活动性',
                  value: detail?.qualityAnomalousEvent?.activityAnalyze
                      ?.activityAnalyzeName,
                  hint: '请选择',
                  contentWeight: -1,
                  arrow: arrowRight)
                  .onTap(() {
                viewModel.chooseActivityAnalyze();
              }),
              TitleInputWidget(
                title: '诊断',
                onChanged: (str) {
                  detail?.qualityAnomalousEvent?.diagnose = str;
                },
                text: detail?.qualityAnomalousEvent?.diagnose ?? "",
              ),
              Column(
                children: [
                  TitleValueWidget(
                      title: '发生地点',
                      value: detail?.qualityAnomalousEvent
                          ?.falldownLocationType?.locationName,
                      hint: '请选择',
                      contentWeight: -1,
                      isRequired: true,
                      arrow: arrowRight)
                      .onTap(() {
                    viewModel.chooseLocation();
                  }),
                  if (detail?.qualityAnomalousEvent?.falldownLocationType ==
                      5) ...[
                    NoBorderInput(
                        text: detail
                            ?.qualityAnomalousEvent?.falldownLocation ??
                            "",
                        hintText: '请输入',
                        onChanged: (str) {
                          detail?.qualityAnomalousEvent?.falldownLocation =
                              str;
                        })
                        .addToContainer(
                        width: double.infinity,
                        decoration: BoxDecoration(
                            color: Color(0xfff7f7f7),
                            borderRadius: 3.borderRadius),
                        padding: EdgeInsets.symmetric(
                            horizontal: 16, vertical: 12)),
                    SizedBox(
                      height: 14,
                    )
                  ]
                ],
              ),
              TitleValueWidget(
                  title: '跌倒描述人',
                  value: detail?.qualityAnomalousEvent?.qualityBy
                      ?.comboDataName(
                      (viewModel.comboListMap['400004'] ?? [])),
                  hint: '请选择',
                  contentWeight: -1,
                  isRequired: false,
                  arrow: arrowRight)
                  .onTap(() {
                viewModel.chooseComboInfo(
                    code: '400004',
                    currentValue: detail?.qualityAnomalousEvent?.qualityBy,
                    onApply: (value) {
                      setState(() {
                        detail?.qualityAnomalousEvent?.qualityBy =
                            value.codeValue;
                      });
                    });
              }),
              TitleInputWidget(
                title: '跌倒描述人姓名',
                onChanged: (str) {
                  detail?.qualityAnomalousEvent?.foundName = str;
                },
                isRow: true,
                text: detail?.qualityAnomalousEvent?.foundName ?? "",
              ),
              TitleInputWidget(
                title: '跌倒描述人职位',
                onChanged: (str) {
                  detail?.qualityAnomalousEvent?.foundPosts = str;
                },
                isRow: true,
                text: detail?.qualityAnomalousEvent?.foundPosts ?? "",
              ),
              TitleInputWidget(
                title: '长辈情况',
                onChanged: (str) {
                  detail?.qualityAnomalousEvent?.circumstanceRemark = str;
                },
                isRow: true,
                text: detail?.qualityAnomalousEvent?.circumstanceRemark ?? "",
              ),
              TitleInputWidget(
                title: '本次跌倒事件为本次入住中第几次跌倒',
                onChanged: (str) {
                  detail?.qualityAnomalousEvent?.falldownTimes =
                      num.tryParse(str);
                },
                isRow: true,
                titleWeight: 3,
                contentWeight: 1,
                text: detail?.qualityAnomalousEvent?.falldownTimes
                    ?.toStringOrNull() ??
                    "",
              ),
              TitleInputWidget(
                title: '事件说明（含时间前因及背景描述）',
                onChanged: (str) {
                  detail?.qualityAnomalousEvent?.eventDescription = str;
                },
                isRequired: true,
                text: detail?.qualityAnomalousEvent?.eventDescription ?? "",
              ),
              TitleInputWidget(
                title: '处理情形（含通报主管）',
                onChanged: (str) {
                  detail?.qualityAnomalousEvent?.processDescription = str;
                },
                isRequired: true,
                text: detail?.qualityAnomalousEvent?.processDescription ?? "",
              ),
              TitleValueWidget(
                  title: '发生于下列何种活动过程中',
                  value: detail
                      ?.qualityAnomalousEvent?.occurrenceActivityType
                      ?.comboDataName((viewModel.comboListMap['97'] ?? [])),
                  hint: '请选择',
                  contentWeight: -1,
                  isRequired: false,
                  arrow: arrowRight)
                  .onTap(() {
                viewModel.chooseComboInfo(
                    code: '97',
                    currentValue: detail
                        ?.qualityAnomalousEvent?.occurrenceActivityType
                        ?.toStringOrNull(),
                    onApply: (value) {
                      setState(() {
                        detail?.qualityAnomalousEvent?.occurrenceActivityType =
                            num.tryParse(value.codeValue!);
                      });
                    });
              }),
              TitleValueWidget(
                  title: '下床（或移动）动机为何',
                  value: detail?.qualityAnomalousEvent?.motivationType
                      ?.comboDataName((viewModel.comboListMap['96'] ?? [])),
                  hint: '请选择',
                  contentWeight: -1,
                  isRequired: false,
                  arrow: arrowRight)
                  .onTap(() {
                viewModel.chooseComboInfo(
                    code: '96',
                    currentValue: detail?.qualityAnomalousEvent?.motivationType
                        ?.toStringOrNull(),
                    onApply: (value) {
                      setState(() {
                        detail?.qualityAnomalousEvent?.motivationType =
                            num.tryParse(value.codeValue!);
                      });
                    });
              }),
              TitleValueWidget(
                  title: '事件发生时是否已使用床栏的保护',
                  value: detail?.qualityAnomalousEvent?.bedrailUsage
                      ?.bedrailUsageName,
                  hint: '请选择',
                  contentWeight: -1,
                  isRequired: false,
                  arrow: arrowRight)
                  .onTap(() {
                viewModel.chooseBedrailUsage();
              }),
              TitleValueWidget(
                  title: '跌倒前是否事先建立【高危险性上-跌倒】的护理计划',
                  value: detail
                      ?.qualityAnomalousEvent?.antiFalldownPlan.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseYesOrNo(
                    detail?.qualityAnomalousEvent?.antiFalldownPlan, (value) {
                  setState(() {
                    detail?.qualityAnomalousEvent?.antiFalldownPlan = value;
                  });
                });
              }),
              TitleValueWidget(
                  title: '事件发生前是否给予【预防跌倒】宣教或说明',
                  value: detail
                      ?.qualityAnomalousEvent?.preventiveAction.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseYesOrNo(
                    detail?.qualityAnomalousEvent?.preventiveAction, (value) {
                  setState(() {
                    detail?.qualityAnomalousEvent?.preventiveAction = value;
                  });
                });
              }),
              Column(
                children: [
                  SizedBox(
                    height: 15,
                  ),
                  CommonText('跌倒事件发生前24小时内，若曾使用下联何种药物请填上药名',
                      textColor: Colours.text_dark),
                  SizedBox(
                    height: 15,
                  ),
                  ...[
                    CheckInputWidget(
                      title: '镇静安眠药',
                      onChanged: (str) {
                        detail?.qualityAnomalousEvent?.sedativeName = str;
                      },
                      onCheckChange: (checked) {
                        detail?.qualityAnomalousEvent?.useSedative =
                        checked ? 1 : 0;
                      },
                      isChecked:
                      detail?.qualityAnomalousEvent?.useSedative == 1,
                    ),
                    CheckInputWidget(
                      title: '抗组织胺',
                      onChanged: (str) {
                        detail?.qualityAnomalousEvent?.antihistamineName = str;
                      },
                      onCheckChange: (checked) {
                        detail?.qualityAnomalousEvent?.useAntihistamine =
                        checked ? 1 : 0;
                      },
                      isChecked:
                      detail?.qualityAnomalousEvent?.useAntihistamine == 1,
                    ),
                    CheckInputWidget(
                      title: '心血管用药',
                      onChanged: (str) {
                        detail?.qualityAnomalousEvent?.angiomyocardiacName =
                            str;
                      },
                      onCheckChange: (checked) {
                        detail?.qualityAnomalousEvent?.useAngiomyocardiac =
                        checked ? 1 : 0;
                      },
                      isChecked:
                      detail?.qualityAnomalousEvent?.useAngiomyocardiac ==
                          1,
                    ),
                    CheckInputWidget(
                      title: '麻醉药/止疼剂',
                      onChanged: (str) {
                        detail?.qualityAnomalousEvent?.analgeticName = str;
                      },
                      onCheckChange: (checked) {
                        detail?.qualityAnomalousEvent?.useAnalgetic =
                        checked ? 1 : 0;
                      },
                      isChecked:
                      detail?.qualityAnomalousEvent?.useAnalgetic == 1,
                    ),
                    CheckInputWidget(
                      title: '轻泻剂',
                      onChanged: (str) {
                        detail?.qualityAnomalousEvent?.aperientName = str;
                      },
                      onCheckChange: (checked) {
                        detail?.qualityAnomalousEvent?.useAperient =
                        checked ? 1 : 0;
                      },
                      isChecked:
                      detail?.qualityAnomalousEvent?.useAperient == 1,
                    ),
                    CheckInputWidget(
                      title: '利尿剂',
                      onChanged: (str) {
                        detail?.qualityAnomalousEvent?.diuretic = str;
                      },
                      onCheckChange: (checked) {
                        detail?.qualityAnomalousEvent?.useDiuretic =
                        checked ? 1 : 0;
                      },
                      isChecked:
                      detail?.qualityAnomalousEvent?.useDiuretic == 1,
                    ),
                    CheckInputWidget(
                      title: '其他药物',
                      onChanged: (str) {
                        detail?.qualityAnomalousEvent?.otherMedicineName = str;
                      },
                      onCheckChange: (checked) {
                        detail?.qualityAnomalousEvent?.useOtherMedicine =
                        checked ? 1 : 0;
                      },
                      isChecked:
                      detail?.qualityAnomalousEvent?.useOtherMedicine == 1,
                    ),
                  ].insertWidget(Container(
                    height: 1,
                    color: Colours.line,
                    margin: EdgeInsets.symmetric(vertical: 5),
                  ))
                ],
              ),
              TitleValueWidget(
                  title: '跌倒前的体位',
                  value: detail
                      ?.qualityAnomalousEvent?.bodyPositionBeforeFallingType
                      ?.comboDataName(
                      (viewModel.comboListMap['44263'] ?? [])),
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseComboInfo(
                    code: '44263',
                    onApply: (item) {
                      setState(() {
                        detail?.qualityAnomalousEvent
                            ?.bodyPositionBeforeFallingType =
                            num.tryParse(item.codeValue!);
                      });
                    });
              }),
              TitleValueWidget(
                  title: '辅具/环境',
                  value: detail
                      ?.qualityAnomalousEvent?.accessoriesOrEnvironmentType
                      ?.comboDataName(
                      (viewModel.comboListMap['5878'] ?? [])),
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseComboInfo(
                    code: '5878',
                    onApply: (item) {
                      setState(() {
                        detail?.qualityAnomalousEvent
                            ?.accessoriesOrEnvironmentType =
                            num.tryParse(item.codeValue!);
                      });
                    });
              }),
              TitleValueWidget(
                  title: '跌倒前的约束状态',
                  value: detail?.qualityAnomalousEvent
                      ?.constraintStatusBeforeFalling.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseYesOrNo(
                    detail?.qualityAnomalousEvent
                        ?.constraintStatusBeforeFalling, (value) {
                  setState(() {
                    detail?.qualityAnomalousEvent
                        ?.constraintStatusBeforeFalling = value;
                  });
                });
              }),
              TitleValueWidget(
                  title: '穿鞋情况',
                  value: detail
                      ?.qualityAnomalousEvent?.wearingShoesSituationType
                      ?.comboDataName(
                      (viewModel.comboListMap['4319'] ?? [])),
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseComboInfo(
                    code: '4319',
                    onApply: (item) {
                      setState(() {
                        detail?.qualityAnomalousEvent
                            ?.wearingShoesSituationType =
                            num.tryParse(item.codeValue!);
                      });
                    });
              }),
              TitleValueWidget(
                  title: '辅具',
                  value: detail?.qualityAnomalousEvent?.accessories
                      ?.equipmentName(viewModel.equipmentList),
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseEquipment();
              }),
              TitleValueWidget(
                  title: '视力辅具',
                  value: detail
                      ?.qualityAnomalousEvent?.visionAccessories.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseYesOrNo(
                    detail?.qualityAnomalousEvent?.visionAccessories, (value) {
                  setState(() {
                    detail?.qualityAnomalousEvent?.visionAccessories = value;
                  });
                });
              }),
              TitleValueWidget(
                  title: '助听器',
                  value:
                  detail?.qualityAnomalousEvent?.hearingAids.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseYesOrNo(
                    detail?.qualityAnomalousEvent?.hearingAids, (value) {
                  setState(() {
                    detail?.qualityAnomalousEvent?.hearingAids = value;
                  });
                });
              }),
              TitleValueWidget(
                  title: '告知家属',
                  value: detail
                      ?.qualityAnomalousEvent?.informFamilies.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseYesOrNo(
                    detail?.qualityAnomalousEvent?.informFamilies, (value) {
                  setState(() {
                    detail?.qualityAnomalousEvent?.informFamilies = value;
                  });
                });
              }),
              TitleValueWidget(
                  title: '已通知医生',
                  value:
                  detail?.qualityAnomalousEvent?.informDoctor.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseYesOrNo(
                    detail?.qualityAnomalousEvent?.informDoctor, (value) {
                  setState(() {
                    detail?.qualityAnomalousEvent?.informDoctor = value;
                  });
                });
              }),
              TitleValueWidget(
                  title: '已通知护士',
                  value:
                  detail?.qualityAnomalousEvent?.informNurse.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseYesOrNo(
                    detail?.qualityAnomalousEvent?.informNurse, (value) {
                  setState(() {
                    detail?.qualityAnomalousEvent?.informNurse = value;
                  });
                });
              }),
              TitleValueWidget(
                  title: '打急救电话',
                  value: detail
                      ?.qualityAnomalousEvent?.callEmergencyNumber.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseYesOrNo(
                    detail?.qualityAnomalousEvent?.callEmergencyNumber,
                        (value) {
                      setState(() {
                        detail?.qualityAnomalousEvent?.callEmergencyNumber = value;
                      });
                    });
              }),
              TitleValueWidget(
                  title: '跌倒时有无陪伴',
                  value:
                  detail?.qualityAnomalousEvent?.fallAccompany.haveOrNot,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseYesOrNo(
                    detail?.qualityAnomalousEvent?.fallAccompany, (value) {
                  setState(() {
                    detail?.qualityAnomalousEvent?.fallAccompany = value;
                  });
                });
              }),
              TitleValueWidget(
                  title: '跌倒外在因素',
                  value: detail?.qualityAnomalousEvent?.fallFactor
                      ?.comboDataName(
                      (viewModel.comboListMap['400006'] ?? [])),
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseComboInfo(
                    code: '400006',
                    onApply: (item) {
                      setState(() {
                        detail?.qualityAnomalousEvent?.fallFactor =
                            item.codeValue;
                      });
                    });
              }),
              TitleValueWidget(
                  title: '通知医生时间',
                  value: detail?.qualityAnomalousEvent?.doctorDate ?? "",
                  hint: '请选择',
                  contentWeight: -1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseTime(detail?.qualityAnomalousEvent?.doctorDate,
                        (dateTime) {
                      setState(() {
                        detail?.qualityAnomalousEvent?.doctorDate = dateTime;
                      });
                    });
              }),
              TitleValueWidget(
                  title: '通知护士时间',
                  value: detail?.qualityAnomalousEvent?.nurseDate ?? "",
                  hint: '请选择',
                  contentWeight: -1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseTime(detail?.qualityAnomalousEvent?.nurseDate,
                        (dateTime) {
                      setState(() {
                        detail?.qualityAnomalousEvent?.nurseDate = dateTime;
                      });
                    });
              }),
              TitleValueWidget(
                  title: '通知家属时间',
                  value:
                  detail?.qualityAnomalousEvent?.dependentsDate ?? "",
                  hint: '请选择',
                  contentWeight: -1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseTime(
                    detail?.qualityAnomalousEvent?.dependentsDate, (dateTime) {
                  setState(() {
                    detail?.qualityAnomalousEvent?.dependentsDate = dateTime;
                  });
                });
              }),
              TitleValueWidget(
                  title: '48H内是否送医',
                  value: detail
                      ?.qualityAnomalousEvent?.evacuateHospital.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseYesOrNo(
                    detail?.qualityAnomalousEvent?.evacuateHospital, (value) {
                  setState(() {
                    detail?.qualityAnomalousEvent?.evacuateHospital = value;
                  });
                });
              }),
              TitleValueWidget(
                  title: '48H内是否去世',
                  value: detail?.qualityAnomalousEvent?.passAway.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseYesOrNo(detail?.qualityAnomalousEvent?.passAway,
                        (value) {
                      setState(() {
                        detail?.qualityAnomalousEvent?.passAway = value;
                      });
                    });
              }),
              Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  TitleValueWidget(
                      title: '选择通知人',
                      value: '',
                      hint: '请选择',
                      contentWeight: 1,
                      isRequired: false,
                      arrow: arrowRight,
                      textAlign: TextAlign.end).onTap(() {
                    viewModel.chooseNotify();
                  }),

                  if((detail?.qualityAnomalousEvent?.messageMan??[]).isNotEmpty)
                    ...[
                      Wrap(
                        spacing: 10,runSpacing: 10,
                        children: (detail?.qualityAnomalousEvent?.messageMan??[]).map((e) => CommonText(e['name'],textColor: Colors.blue).addToContainer(
                            decoration: BoxDecoration(color: Colors.blue.withOpacity(0.4),borderRadius: 4.borderRadius),
                            padding: EdgeInsets.symmetric(horizontal: 8,vertical: 3)
                        )).toList(),
                      ),
                      SizedBox(height: 12,)
                    ]
                ],
              ),

              Column(
                children: [
                  TitleValueWidget(
                      title: '入住时跌倒高危险群筛选正确性',
                      value: detail?.qualityAnomalousEvent
                          ?.falldownScreenCorrectness ==
                          1
                          ? '是'
                          : detail?.qualityAnomalousEvent
                          ?.falldownScreenCorrectness ==
                          0
                          ? '其他'
                          : '',
                      hint: '请选择',
                      contentWeight: 1,
                      isRequired: false,
                      arrow: arrowRight,
                      textAlign: TextAlign.end)
                      .onTap(() {
                    viewModel.chooseYesOrNo(
                        detail?.qualityAnomalousEvent
                            ?.falldownScreenCorrectness, (value) {
                      setState(() {
                        detail?.qualityAnomalousEvent
                            ?.falldownScreenCorrectness = value;
                      });
                    });
                  }),
                  if (detail
                      ?.qualityAnomalousEvent?.falldownScreenCorrectness ==
                      0) ...[
                    NoBorderInput(
                      hintText: '请输入',
                      text:
                      detail?.qualityAnomalousEvent?.screenIncorrectItem ??
                          "",
                      onChanged: (str) {
                        detail?.qualityAnomalousEvent?.screenIncorrectItem =
                            str;
                      },
                    ).addToContainer(
                        decoration: BoxDecoration(
                            color: Color(0xfff7f7f7),
                            borderRadius: 3.borderRadius),
                        padding:
                        EdgeInsets.symmetric(horizontal: 16, vertical: 12)),
                    SizedBox(
                      height: 14,
                    )
                  ]
                ],
              ),
              TitleValueWidget(
                  title: '跌倒造成的伤害',
                  value:
                  detail?.qualityAnomalousEvent?.damageLevelName ?? "",
                  hint: '请选择',
                  contentWeight: 2,
                  titleWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end)
                  .onTap(() {
                viewModel.chooseComboInfo(
                    code: '59',
                    onApply: (item) {
                      setState(() {
                        detail?.qualityAnomalousEvent?.damageLevelName =
                            item.nameCn;
                        detail?.qualityAnomalousEvent?.damageLevel =
                            num.tryParse(item.codeValue!);
                      });
                    },
                    itemExtent: 60);
              }),
              TitleVerticalContent(
                  title: '跌倒发生时长者的受伤部位(可复选)',
                  child: Wrap(
                    spacing: 16,
                    children: [
                      CheckTextItem(
                        title: '头',
                        onChanged: (value) {
                          detail?.qualityAnomalousEvent?.damageParts = detail
                              ?.qualityAnomalousEvent?.damageParts
                              .appandList(value, '1');
                        },
                        fill: false,
                        defaultSelected: detail
                            ?.qualityAnomalousEvent?.damageParts
                            ?.contains("1") ==
                            true,
                      ),
                      CheckTextItem(
                        title: '颈部',
                        onChanged: (value) {
                          detail?.qualityAnomalousEvent?.damageParts = detail
                              ?.qualityAnomalousEvent?.damageParts
                              .appandList(value, '2');
                        },
                        fill: false,
                        defaultSelected: detail
                            ?.qualityAnomalousEvent?.damageParts
                            ?.contains("2") ==
                            true,
                      ),
                      CheckTextItem(
                        title: '手',
                        onChanged: (value) {
                          detail?.qualityAnomalousEvent?.damageParts = detail
                              ?.qualityAnomalousEvent?.damageParts
                              .appandList(value, '3');
                        },
                        fill: false,
                        defaultSelected: detail
                            ?.qualityAnomalousEvent?.damageParts
                            ?.contains("3") ==
                            true,
                      ),
                      CheckTextItem(
                        title: '腿',
                        onChanged: (value) {
                          detail?.qualityAnomalousEvent?.damageParts = detail
                              .qualityAnomalousEvent?.damageParts
                              .appandList(value, '4');
                        },
                        fill: false,
                        defaultSelected: detail
                            ?.qualityAnomalousEvent?.damageParts
                            ?.contains("4") ==
                            true,
                      ),
                    ],
                  )),
              TitleVerticalContent(
                  title: '造成跌倒的原因',
                  child: Column(
                    children: [
                      Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          CheckTextItem(
                            title: '健康状态',
                            onChanged: (value) {
                              detail?.qualityAnomalousEvent?.isHealthStatus =
                              value ? 1 : 0;
                            },
                            defaultSelected:
                            detail?.qualityAnomalousEvent?.isHealthStatus ==
                                1,
                          ),
                          SizedBox(
                            height: 12,
                          ),
                          Row(
                            children: [
                              SizedBox(
                                width: 16,
                              ),
                              CheckTextItem(
                                title: '意识不清',
                                onChanged: (value) {
                                  detail?.qualityAnomalousEvent?.healthStatus =
                                      detail?.qualityAnomalousEvent?.healthStatus.appandList(value, '1');
                                },
                                defaultSelected: detail
                                    ?.qualityAnomalousEvent?.healthStatus
                                    ?.contains("1") ==
                                    true,
                              ).setWeight(1),
                              CheckTextItem(
                                title: '睡眠不足',
                                onChanged: (value) {
                                  detail?.qualityAnomalousEvent?.healthStatus =
                                      detail?.qualityAnomalousEvent?.healthStatus.appandList(value, '2');
                                },
                                defaultSelected: detail
                                    ?.qualityAnomalousEvent?.healthStatus
                                    ?.contains("2") ==
                                    true,
                              ).setWeight(1),
                              CheckTextItem(
                                title: '步态平衡异常',
                                onChanged: (value) {
                                  detail?.qualityAnomalousEvent?.healthStatus =
                                      detail?.qualityAnomalousEvent?.healthStatus.appandList(value, '3');
                                },
                                defaultSelected: detail
                                    ?.qualityAnomalousEvent?.healthStatus
                                    ?.contains("3") ==
                                    true,
                              ).setWeight(1),
                            ],
                          ),
                          SizedBox(
                            height: 12,
                          ),
                          Row(
                            children: [
                              SizedBox(
                                width: 16,
                              ),
                              CheckTextItem(
                                title: '血色素低头晕 hb',
                                onChanged: (value) {
                                  detail?.qualityAnomalousEvent?.healthStatus =
                                      detail?.qualityAnomalousEvent?.healthStatus.appandList(value, '4');
                                },
                                defaultSelected: detail
                                    ?.qualityAnomalousEvent?.healthStatus
                                    ?.contains("4") ==
                                    true,
                              ).setWeight(2),
                              Row(
                                children: [
                                  NoBorderInput(
                                      hintText: '请输入',
                                      onChanged: (str) {
                                        detail?.qualityAnomalousEvent
                                            ?.healthStatusHemoglobin =
                                            num.tryParse(str);
                                      },
                                      keyboardType:
                                      CommonInputType.numberAndDecimal)
                                      .addToContainer(
                                      decoration: BoxDecoration(
                                          color: Colours.bg_color,
                                          borderRadius: 3.borderRadius),
                                      padding: EdgeInsets.symmetric(
                                          horizontal: 6, vertical: 2))
                                      .setWeight(1),
                                  CommonText('mg/d')
                                ],
                              ).setWeight(3)
                            ],
                          ),
                          SizedBox(
                            height: 12,
                          ),
                          Row(
                            children: [
                              SizedBox(
                                width: 16,
                              ),
                              CheckTextItem(
                                title: '其他',
                                onChanged: (value) {
                                  detail?.qualityAnomalousEvent?.healthStatus =
                                      detail
                                          ?.qualityAnomalousEvent?.healthStatus
                                          .appandList(value, '5');
                                },
                                defaultSelected: detail
                                    ?.qualityAnomalousEvent?.healthStatus
                                    ?.contains("5") ==
                                    true,
                              ).setWeight(2),
                              Row(
                                children: [
                                  NoBorderInput(
                                      hintText: '请输入',
                                      onChanged: (str) {
                                        detail?.qualityAnomalousEvent
                                            ?.healthStatusOther = str;
                                      })
                                      .addToContainer(
                                      decoration: BoxDecoration(
                                          color: Colours.bg_color,
                                          borderRadius: 3.borderRadius),
                                      padding: EdgeInsets.symmetric(
                                          horizontal: 6, vertical: 2))
                                      .setWeight(1),
                                ],
                              ).setWeight(3)
                            ],
                          )
                        ],
                      ),
                      Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          CheckTextItem(
                            title: '因治疗、药物、麻醉反应',
                            onChanged: (value) {
                              detail?.qualityAnomalousEvent?.isMedicineCure =
                              value ? 1 : 0;
                            },
                            defaultSelected:
                            detail?.qualityAnomalousEvent?.isMedicineCure ==
                                1,
                          ),
                          SizedBox(
                            height: 12,
                          ),
                          Row(
                            children: [
                              SizedBox(
                                width: 16,
                              ),
                              CheckTextItem(
                                  title: '因麻醉因素(麻醉时间及麻醉方式)',
                                  onChanged: (value) {
                                    detail?.qualityAnomalousEvent
                                        ?.isNarcotism = value ? 1 : 0;
                                  },
                                  defaultSelected: detail
                                      ?.qualityAnomalousEvent
                                      ?.isNarcotism ==
                                      1)
                                  .setWeight(2),
                              Row(
                                children: [
                                  NoBorderInput(
                                      hintText: '请输入',
                                      onChanged: (str) {
                                        detail?.qualityAnomalousEvent
                                            ?.narcotismDescription = str;
                                      })
                                      .addToContainer(
                                      decoration: BoxDecoration(
                                          color: Colours.bg_color,
                                          borderRadius: 3.borderRadius),
                                      padding: EdgeInsets.symmetric(
                                          horizontal: 6, vertical: 2))
                                      .setWeight(1),
                                ],
                              ).setWeight(3)
                            ],
                          ),
                          SizedBox(
                            height: 12,
                          ),
                          Row(
                            children: [
                              SizedBox(
                                width: 16,
                              ),
                              CheckTextItem(
                                  title: '因药物因素',
                                  onChanged: (value) {
                                    detail?.qualityAnomalousEvent
                                        ?.isMedicine = value ? 1 : 0;
                                  },
                                  defaultSelected: detail
                                      ?.qualityAnomalousEvent
                                      ?.isMedicine ==
                                      1)
                                  .setWeight(2),
                              Row(
                                children: [
                                  CommonText(
                                      detail?.qualityAnomalousEvent
                                          ?.medicineHours?.medicineHourName,
                                      hintText: '请选择')
                                      .addToContainer(
                                      decoration: BoxDecoration(
                                          color: Colours.bg_color,
                                          borderRadius: 3.borderRadius),
                                      padding: EdgeInsets.symmetric(
                                          horizontal: 6, vertical: 2))
                                      .onTap(() {
                                    if (detail?.qualityAnomalousEvent
                                        ?.isMedicine !=
                                        1) {
                                      return;
                                    }
                                    viewModel.chooseMedicineHours();
                                  }).setWeight(1),
                                ],
                              ).setWeight(3)
                            ],
                          ),
                          SizedBox(
                            height: 12,
                          ),
                          Row(
                            children: [
                              SizedBox(
                                width: 16,
                              ),
                              CheckTextItem(
                                title: '服用药物名',
                                showIcon: false,
                                onChanged: (value){},
                              ).setWeight(2),
                              Row(
                                children: [
                                  NoBorderInput(
                                      hintText: '请输入',
                                      onChanged: (str) {
                                        detail?.qualityAnomalousEvent
                                            ?.medicineDescription = str;
                                      })
                                      .addToContainer(
                                      decoration: BoxDecoration(
                                          color: Colours.bg_color,
                                          borderRadius: 3.borderRadius),
                                      padding: EdgeInsets.symmetric(
                                          horizontal: 6, vertical: 2))
                                      .setWeight(1),
                                ],
                              ).setWeight(3)
                            ],
                          )
                        ],
                      ),
                      Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          CheckTextItem(
                            title: '环境危险因子',
                            onChanged: (value) {
                              detail?.qualityAnomalousEvent?.isEnvironment =
                              value ? 1 : 0;
                            },
                            defaultSelected:
                            detail?.qualityAnomalousEvent?.isEnvironment ==
                                1,
                          ),
                          SizedBox(
                            height: 12,
                          ),
                          Row(
                            children: [
                              SizedBox(
                                width: 16,
                              ),
                              Wrap(
                                children: [
                                  CheckTextItem(
                                    title: '地板湿滑',
                                    onChanged: (value) {
                                      detail?.qualityAnomalousEvent
                                          ?.environmentDescription =
                                          detail?.qualityAnomalousEvent
                                              ?.environmentDescription
                                              .appandList(value, '1');
                                    },
                                    defaultSelected: detail
                                        ?.qualityAnomalousEvent
                                        ?.environmentDescription
                                        ?.contains("1") ==
                                        true,
                                  ),
                                  CheckTextItem(
                                    title: '灯光昏暗',
                                    onChanged: (value) {
                                      detail?.qualityAnomalousEvent
                                          ?.environmentDescription =
                                          detail?.qualityAnomalousEvent
                                              ?.environmentDescription
                                              .appandList(value, '2');
                                    },
                                    defaultSelected: detail
                                        ?.qualityAnomalousEvent
                                        ?.environmentDescription
                                        ?.contains("2") ==
                                        true,
                                  ),
                                  CheckTextItem(
                                    title: '可扶持药品无法触及',
                                    onChanged: (value) {
                                      detail?.qualityAnomalousEvent
                                          ?.environmentDescription =
                                          detail?.qualityAnomalousEvent
                                              ?.environmentDescription
                                              .appandList(value, '3');
                                    },
                                    defaultSelected: detail
                                        ?.qualityAnomalousEvent
                                        ?.environmentDescription
                                        ?.contains("3") ==
                                        true,
                                  ),
                                  CheckTextItem(
                                    title: '有障碍物',
                                    onChanged: (value) {
                                      detail?.qualityAnomalousEvent
                                          ?.environmentDescription =
                                          detail?.qualityAnomalousEvent
                                              ?.environmentDescription
                                              .appandList(value, '4');
                                    },
                                    defaultSelected: detail
                                        ?.qualityAnomalousEvent
                                        ?.environmentDescription
                                        ?.contains("4") ==
                                        true,
                                  ),
                                  CheckTextItem(
                                    title: '未提供辅助器具',
                                    onChanged: (value) {
                                      detail?.qualityAnomalousEvent
                                          ?.environmentDescription =
                                          detail?.qualityAnomalousEvent
                                              ?.environmentDescription
                                              .appandList(value, '5');
                                    },
                                    defaultSelected: detail
                                        ?.qualityAnomalousEvent
                                        ?.environmentDescription
                                        ?.contains("5") ==
                                        true,
                                  ),
                                  CheckTextItem(
                                    title: '其他',
                                    onChanged: (value) {
                                      var str =  detail?.qualityAnomalousEvent
                                          ?.environmentDescription.appandList(value, '6');
                                      print(str);
                                      setState(() {
                                        detail?.qualityAnomalousEvent
                                            ?.environmentDescription = str;
                                      });

                                    },
                                    defaultSelected: detail
                                        ?.qualityAnomalousEvent
                                        ?.environmentDescription
                                        ?.contains("6") ==
                                        true,
                                  ),
                                  if(detail?.qualityAnomalousEvent?.environmentDescription?.contains("6") == true)
                                    NoBorderInput(
                                      hintText: '请输入其他危险因子',
                                      onChanged: (str) {
                                        detail?.qualityAnomalousEvent
                                            ?.otherEnvironmentDescription = str;
                                      },
                                    ).addToContainer(
                                        decoration: BoxDecoration(
                                            color: Color(0xfff7f7f7),
                                            borderRadius: 3.borderRadius),
                                        padding: EdgeInsets.symmetric(
                                            horizontal: 16, vertical: 12)),
                                ].insertWidget(Container(
                                  height: 12,
                                )),
                              ).setWeight(1)
                            ],
                          ),
                        ],
                      ),
                      Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          CheckTextItem(
                              title: '设备损坏',
                              onChanged: (value) {
                                detail?.qualityAnomalousEvent?.isEquipment =
                                value ? 1 : 0;
                              },
                              defaultSelected:
                              detail?.qualityAnomalousEvent?.isEquipment ==
                                  1),
                          SizedBox(
                            height: 12,
                          ),
                          Row(
                            children: [
                              SizedBox(
                                width: 16,
                              ),
                              Wrap(
                                children: [
                                  CheckTextItem(
                                      title: '马桶',
                                      onChanged: (value) {
                                        detail?.qualityAnomalousEvent?.equipmentDescription = detail?.qualityAnomalousEvent?.equipmentDescription.appandList(value, '1');
                                      },
                                      defaultSelected: detail?.qualityAnomalousEvent?.equipmentDescription?.contains("1") == true),
                                  CheckTextItem(
                                      title: '拐杖', onChanged: (value) {
                                    detail?.qualityAnomalousEvent?.equipmentDescription = detail?.qualityAnomalousEvent?.equipmentDescription.appandList(value, '2');
                                  },
                                      defaultSelected: detail?.qualityAnomalousEvent?.equipmentDescription?.contains("2") == true),
                                  CheckTextItem(
                                      title: '助行器', onChanged: (value) {
                                    detail?.qualityAnomalousEvent?.equipmentDescription = detail?.qualityAnomalousEvent?.equipmentDescription.appandList(value, '3');
                                  },
                                      defaultSelected: detail?.qualityAnomalousEvent?.equipmentDescription?.contains("3") == true),
                                  CheckTextItem(
                                      title: '轮椅', onChanged: (value) {
                                    detail?.qualityAnomalousEvent?.equipmentDescription = detail?.qualityAnomalousEvent?.equipmentDescription.appandList(value, '4');
                                  },
                                      defaultSelected: detail?.qualityAnomalousEvent?.equipmentDescription?.contains("4") == true),
                                  CheckTextItem(
                                      title: '担架', onChanged: (value) {
                                    detail?.qualityAnomalousEvent?.equipmentDescription = detail?.qualityAnomalousEvent?.equipmentDescription.appandList(value, '5');
                                  },
                                      defaultSelected: detail?.qualityAnomalousEvent?.equipmentDescription?.contains("5") == true
                                  ),
                                  CheckTextItem(
                                      title: '其他', onChanged: (value) {
                                    setState(() {
                                      detail?.qualityAnomalousEvent?.equipmentDescription = detail?.qualityAnomalousEvent?.equipmentDescription.appandList(value, '6');

                                    });
                                  },
                                      defaultSelected: detail?.qualityAnomalousEvent?.equipmentDescription?.contains("6") == true),
                                  if(detail?.qualityAnomalousEvent?.equipmentDescription?.contains("6")==true)
                                    NoBorderInput(
                                      hintText: '请输入其他设备损坏',
                                      onChanged: (str) {
                                        detail?.qualityAnomalousEvent?.equipmentDescriptionOther = str;
                                      },
                                    ).addToContainer(
                                        decoration: BoxDecoration(
                                            color: Color(0xfff7f7f7),
                                            borderRadius: 3.borderRadius),
                                        padding: EdgeInsets.symmetric(
                                            horizontal: 16, vertical: 12)),
                                ].insertWidget(Container(
                                  height: 12,
                                )),
                              ).setWeight(1)
                            ],
                          ),
                        ],
                      ),
                    ].insertWidget(SizedBox(
                      height: 12,
                    )),
                  )),
              TitleValueWidget(
                  title: '有无造成损伤',
                  value: detail?.qualityAnomalousEvent?.damage.haveOrNot,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end).onTap(() {
                viewModel.chooseYesOrNo(detail?.qualityAnomalousEvent?.damage, (value){
                  setState(() {
                    detail?.qualityAnomalousEvent?.damage = value;
                  });
                },isHave: true);
              }),
              TitleValueWidget(
                  title: '损伤类型',
                  value: detail
                      ?.qualityAnomalousEvent?.wearingShoesSituationType
                      ?.comboDataName(
                      (viewModel.comboListMap['400007'] ?? [])),
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end).onTap(() {
                viewModel.chooseComboInfo(code: '400007', onApply: (item){
                  setState(() {
                    detail
                        ?.qualityAnomalousEvent?.wearingShoesSituationType = num.tryParse(item.codeValue!);
                  });
                });
              }),
              TitleInputWidget(
                title: '损伤的具体描述（部位、意识程度等）',
                contentWeight: -1,
                isRow: false,
                text: detail?.qualityAnomalousEvent?.damageDescription??"",
                hint: '请输入',
                onChanged: (str){
                  detail?.qualityAnomalousEvent?.damageDescription = str;
                },
              )
            ].insertWidget(Gaps.dividerLine),
          ).addToContainer(
              decoration: BoxDecoration(
                color: Colors.white,
              ),
              padding: EdgeInsets.symmetric(horizontal: 12)),
          SizedBox(
            height: 12,
          ),
          Column(
            children: [
              TitleValueWidget(title: '查体', value: '', hint: ''),

              TitleInputWidget(
                title: '腋温（°C）',
                isRow: true,
                keyboardType: CommonInputType.numberAndDecimal,
                text: detail?.qualityAnomalousEvent?.armpitTemperature??"",
                onChanged: (str){
                  detail?.qualityAnomalousEvent?.armpitTemperature = str;
                },
              ),
              TitleInputWidget(
                title: '血压（mmHg)',
                isRow: true,
                keyboardType: CommonInputType.numberAndDecimal,
                text: detail?.qualityAnomalousEvent?.bloodPressure??"",
                onChanged: (str){
                  detail?.qualityAnomalousEvent?.bloodPressure = str;
                },
              ),
              TitleInputWidget(
                title: '脉搏（次/分）',
                isRow: true,
                keyboardType: CommonInputType.number,
                text: detail?.qualityAnomalousEvent?.pulse??"",
                onChanged: (str){
                  detail?.qualityAnomalousEvent?.pulse = str;
                },
              ),
              TitleInputWidget(
                title: '呼吸（次/分）',
                isRow: true,
                keyboardType: CommonInputType.number,
                text: detail?.qualityAnomalousEvent?.breathe??"",
                onChanged: (str){
                  detail?.qualityAnomalousEvent?.breathe = str;
                },
              ),
              TitleInputWidget(
                title: '疼痛评估（VAS）',
                isRow: true,
                keyboardType: CommonInputType.text,
                text: detail?.qualityAnomalousEvent?.painVas??"",
                onChanged: (str){
                  detail?.qualityAnomalousEvent?.painVas = str;
                },
              ),
              TitleInputWidget(
                title: '血氧饱和度（%）',
                isRow: true,
                keyboardType: CommonInputType.number,
                text: detail?.qualityAnomalousEvent?.bloodOxygen??"",
                onChanged: (str){
                  detail?.qualityAnomalousEvent?.bloodOxygen = str;
                },
              ),
              TitleInputWidget(
                title: '疼痛评估（Algoplus）',
                isRow: true,
                keyboardType: CommonInputType.text,
                text: detail?.qualityAnomalousEvent?.painAlg??"",
                onChanged: (str){
                  detail?.qualityAnomalousEvent?.painAlg = str;
                },
              ),

              TitleValueWidget(
                  title: '四肢活动是否异常',
                  value: detail?.qualityAnomalousEvent?.limbs.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end).onTap(() {
                viewModel.chooseYesOrNo(detail?.qualityAnomalousEvent?.limbs, (value) {
                  setState(() {
                    detail?.qualityAnomalousEvent?.limbs = value;
                  });
                });
              }),
              TitleValueWidget(
                  title: '是否使用抗凝剂',
                  value: detail?.qualityAnomalousEvent?.anticoagulant.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end).onTap(() {
                viewModel.chooseYesOrNo(detail?.qualityAnomalousEvent?.anticoagulant, (value) {
                  setState(() {
                    detail?.qualityAnomalousEvent?.anticoagulant = value;
                  });
                });
              }),

              TitleInputWidget(
                title: '临床检查及初步诊断',
                isRow: false,
                keyboardType: CommonInputType.text,
                contentWeight: -1,
                text: detail?.qualityAnomalousEvent?.diagnosis??"",
                onChanged: (str){
                  detail?.qualityAnomalousEvent?.diagnosis = str;
                },
              ),
              TitleInputWidget(
                title: '抗凝剂药品名',
                isRow: false,
                keyboardType: CommonInputType.text,
                contentWeight: -1,
                text: detail?.qualityAnomalousEvent?.anticoagulantName??"",
                onChanged: (str){
                  detail?.qualityAnomalousEvent?.anticoagulantName = str;
                },
              ),
              TitleValueWidget(
                  title: '是否与药源因素相关',
                  value: detail?.qualityAnomalousEvent?.medicinalSource.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end).onTap(() {
                viewModel.chooseYesOrNo(detail?.qualityAnomalousEvent?.medicinalSource, (value) {
                  setState(() {
                    detail?.qualityAnomalousEvent?.medicinalSource = value;
                  });
                });
              }),
              TitleInputWidget(
                title: '药源性因素的药品',
                isRow: false,
                keyboardType: CommonInputType.text,
                contentWeight: -1,
                text: detail?.qualityAnomalousEvent?.medicinalSourceName??"",
                onChanged: (str){
                  detail?.qualityAnomalousEvent?.medicinalSourceName = str;
                },
              ),
              TitleInputWidget(
                title: '措施（现场+多学科讨论）',
                isRow: false,
                keyboardType: CommonInputType.text,
                contentWeight: -1,
                text: detail?.qualityAnomalousEvent?.measure??"",
                onChanged: (str){
                  detail?.qualityAnomalousEvent?.measure = str;
                },
              ),
              TitleValueWidget(
                  title: '是否修改护理计划',
                  value: detail?.qualityAnomalousEvent?.nurseType.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end).onTap(() {
                viewModel.chooseYesOrNo(detail?.qualityAnomalousEvent?.nurseType, (value) {
                  setState(() {
                    detail?.qualityAnomalousEvent?.nurseType = value;
                  });
                });
              }),

              ///下拉单选，选择“是”时，出现修改日期的填写
              if(detail?.qualityAnomalousEvent?.nurseType==1)
                TitleValueWidget(
                    title: '修改日期',
                    value: detail?.qualityAnomalousEvent?.nurseTypeDate??"",
                    hint: '请选择',
                    contentWeight: 1,
                    isRequired: false,
                    arrow: arrowRight,
                    textAlign: TextAlign.end).onTap(() {
                  viewModel.chooseDate(detail?.qualityAnomalousEvent?.nurseTypeDate, (dateTime) {
                    setState(() {
                      detail?.qualityAnomalousEvent?.nurseTypeDate = dateTime;
                    });
                  });
                }),

              TitleValueWidget(
                  title: '是否修改个人计划',
                  value: detail?.qualityAnomalousEvent?.single.yesOrNo,
                  hint: '请选择',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight,
                  textAlign: TextAlign.end).onTap(() {
                viewModel.chooseYesOrNo(detail?.qualityAnomalousEvent?.single, (value){
                  setState(() {
                    detail?.qualityAnomalousEvent?.single = value;
                  });
                });
              }),

              ///下拉单选，选择“是”时，出现修改日期的填写
              if(detail?.qualityAnomalousEvent?.single==1)
                TitleValueWidget(
                    title: '修改日期',
                    value: detail?.qualityAnomalousEvent?.singleDate??"",
                    hint: '请选择',
                    contentWeight: 1,
                    isRequired: false,
                    arrow: arrowRight,
                    textAlign: TextAlign.end).onTap(() {
                  viewModel.chooseDate(detail?.qualityAnomalousEvent?.singleDate, (dateTime) {
                    setState(() {
                      detail?.qualityAnomalousEvent?.singleDate = dateTime;
                    });
                  });
                }),
            ].insertWidget(Gaps.dividerLine),
          ).addToContainer(
              decoration: BoxDecoration(
                color: Colors.white,
              ),
              padding: EdgeInsets.symmetric(horizontal: 12)),
          // SizedBox(
          //   height: 12,
          // ),
          // CheckWithText(
          //   title: '是否生成交接班',
          //   onChanged: (value) {
          //     detail?.qualityAnomalousEvent?.generateShiftInformation = value?1:0;
          //   },
          //   textStyle: TextStyle(color: Colours.text_dark),defaultSelected: detail?.qualityAnomalousEvent?.generateShiftInformation==1,
          // ).addToContainer(
          //     width: double.infinity,
          //     decoration: BoxDecoration(
          //       color: Colors.white,
          //     ),
          //     padding: EdgeInsets.symmetric(horizontal: 12, vertical: 12)),
          SizedBox(
            height: 24,
          ),
          TextButton(
            onPressed: () {
              viewModel.submitSave();
            },
            child: CommonText('保存', textColor: Colors.white),
            style: badEventButtonStyle,
          ).addToContainer(
            margin: EdgeInsets.symmetric(horizontal: 12),
          ),
          SizedBox(
            height: 34,
          )
        ],
      ),
    );
  }

  Widget medicineEventWidget(){
    var detail = viewModel.eventDetail;
    return SingleChildScrollView(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          SizedBox(
            height: 8,
          ),
          Column(
            children: [
              TitleValueWidget(
                  title: '长者姓名',
                  value: detail?.customerName ?? "",
                  hint: '请选择',
                  isRequired: true,
                  contentWeight: -1,
                  arrow: arrowRight).onTap(() {
                    viewModel.chooseElder();
              }),
              TitleValueWidget(
                title: '床位号',
                value: detail?.bedNo ?? "",
                hint: '根据老人自动显示',
                contentWeight: -1,
              ),
              TitleValueWidget(
                title: '性别',
                value: detail?.sexName ?? "",
                hint: '根据老人自动显示',
                contentWeight: -1,
              ),
              TitleValueWidget(
                  title: '发生时间',
                  value: detail?.occurrenceTime ?? "",
                  contentWeight: -1,
                  arrow: arrowRight).onTap(() {
                viewModel.chooseOccurrenceTime();
              }),
              TitleValueWidget(
                  title: '事发时意识状态',
                  value: detail?.qualityAnomalousEvent?.consciousState ?? "",
                  hint: '请选择',
                  contentWeight: -1,
                  arrow: arrowRight).onTap(() {
                viewModel.chooseConsciousState();
              }),
              TitleInputWidget(
                title: '诊断',
                hint: '请输入',
                text: detail?.qualityAnomalousEvent?.diagnose ?? "",
                inEdit: true,
                onChanged: (str){
                  detail?.qualityAnomalousEvent?.diagnose = str;
                },
              ),
              TitleValueWidget(
                  title: '长者活动性',
                  value: detail?.qualityAnomalousEvent?.activityAnalyze
                      .activityAnalyzeName,
                  hint: '请选择',
                  contentWeight: -1,
                  arrow: arrowRight).onTap(() {
                viewModel.chooseActivityAnalyze();
              }),
              Column(
                children: [
                  TitleValueWidget(
                      title: '发生地点',
                      value: detail?.qualityAnomalousEvent?.occurLocationType
                          .locationName,
                      hint: '请选择',
                      contentWeight: -1,
                      isRequired: true,
                      arrow: arrowRight).onTap(() {
                    viewModel.chooseMedicineLocation();
                  }),
                  if (detail?.qualityAnomalousEvent?.occurLocationType == 5)
                    NoBorderInput(text: detail?.qualityAnomalousEvent?.occurLocation,onChanged: (str){
                      detail?.qualityAnomalousEvent?.occurLocation = str;
                    })
                        .addToContainer(
                        width: double.infinity,
                        decoration: BoxDecoration(
                            color: Color(0xfff7f7f7),
                            borderRadius: 3.borderRadius),
                        padding: EdgeInsets.symmetric(
                            horizontal: 16, vertical: 12)),
                ],
              ),
              Column(
                children: [
                  TitleValueWidget(
                      title: '发现人员',
                      value: detail?.qualityAnomalousEvent?.findStaffType
                          .findStaffTypeName,
                      hint: '请选择',
                      contentWeight: -1,
                      isRequired: true,
                      arrow: arrowRight).onTap(() {
                        viewModel.chooseFindStaff();
                  }),
                  if (detail?.qualityAnomalousEvent?.findStaffType == 3)
                    NoBorderInput(text: detail?.qualityAnomalousEvent?.findStaff,onChanged: (str){
                      detail?.qualityAnomalousEvent?.findStaff = str;
                    })
                        .addToContainer(
                        width: double.infinity,
                        decoration: BoxDecoration(
                            color: Color(0xfff7f7f7),
                            borderRadius: 3.borderRadius),
                        padding: EdgeInsets.symmetric(
                            horizontal: 16, vertical: 12)),
                ],
              ),
              if(detail?.eventType==4)
                Column(
                  children: [
                    TitleValueWidget(
                        title: '造成人员',
                        value: detail?.qualityAnomalousEvent?.causePersonType
                            .causePersonTypeName,
                        hint: '请选择',
                        contentWeight: -1,
                        isRequired: true,
                        arrow: arrowRight).onTap(() {
                          viewModel.chooseCausePerson();
                    }),
                    if (detail?.qualityAnomalousEvent?.causePersonType == 4)
                      NoBorderInput(text: detail?.qualityAnomalousEvent?.causePerson,onChanged: (str){
                        detail?.qualityAnomalousEvent?.causePerson = str;
                      })
                          .addToContainer(
                          width: double.infinity,
                          decoration: BoxDecoration(
                              color: Color(0xfff7f7f7),
                              borderRadius: 3.borderRadius),
                          padding: EdgeInsets.symmetric(
                              horizontal: 16, vertical: 12)),
                  ],
                ),
              if(detail?.eventType==4)
                Column(
                  children: [
                    TitleValueWidget(
                        title: '错误形态类型',
                        value: detail?.qualityAnomalousEvent?.wrongPatternType
                            .wrongPatternTypeName,
                        hint: '请选择',
                        contentWeight: -1,
                        isRequired: false,
                        arrow: arrowRight).onTap(() {
                          viewModel.chooseWrongPattern();
                    }),
                    if (detail?.qualityAnomalousEvent?.wrongPatternType == 13)
                      NoBorderInput(text: detail?.qualityAnomalousEvent?.wrongPattern,onChanged: (str){
                        detail?.qualityAnomalousEvent?.wrongPattern = str;
                      })
                          .addToContainer(
                          width: double.infinity,
                          decoration: BoxDecoration(
                              color: Color(0xfff7f7f7),
                              borderRadius: 3.borderRadius),
                          padding: EdgeInsets.symmetric(
                              horizontal: 16, vertical: 12)),
                  ],
                ),
              if(detail?.eventType==4)
                TitleInputWidget(
                  title: '应给药名（剂型）',
                  text: detail?.qualityAnomalousEvent?.correctDrugName ?? "",
                  isRow: true,
                  hint: '请输入',
                  onChanged: (str){
                    detail?.qualityAnomalousEvent?.correctDrugName = str;
                  },
                ),
              if(detail?.eventType==4)
                TitleInputWidget(
                  title: '给错药名（剂型）',
                  text: detail?.qualityAnomalousEvent?.wrongDrugName ?? "",
                  isRow: true,
                  hint: '请输入',
                  onChanged: (str){
                    detail?.qualityAnomalousEvent?.wrongDrugName = str;
                  },

                ),
            ].insertWidget(Gaps.dividerLine),
          ).addToContainer(
              decoration: BoxDecoration(
                color: Colors.white,
              ),
              padding: EdgeInsets.symmetric(horizontal: 12)),
          SizedBox(
            height: 12,
          ),
          Column(
            children: [
              TitleInputWidget(
                title: '事件说明（含时间前因及背景描述）',
                isRequired: true,
                text: detail?.qualityAnomalousEvent?.eventDescription ?? "",
                hint: '请输入',
                onChanged: (str){
                  detail?.qualityAnomalousEvent?.eventDescription = str;
                },
              ),
              TitleInputWidget(
                title: '处理情形（含通报主管）',
                isRequired: true,
                text: detail?.qualityAnomalousEvent?.eventDisposal ?? "",
                hint: '请输入',
                onChanged: (str){
                  detail?.qualityAnomalousEvent?.eventDisposal = str;
                },
              ),
              Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  TitleValueWidget(
                      title: '选择通知人',
                      value: '',
                      hint: '请选择',
                      contentWeight: 1,
                      isRequired: false,
                      arrow: arrowRight,
                      textAlign: TextAlign.end).onTap(() {
                    viewModel.chooseNotify();
                  }),

                  if((detail?.qualityAnomalousEvent?.messageMan??[]).isNotEmpty)
                    ...[
                      Wrap(
                        spacing: 10,runSpacing: 10,
                        children: (detail?.qualityAnomalousEvent?.messageMan??[]).map((e) => CommonText(e['name'],textColor: Colors.blue).addToContainer(
                            decoration: BoxDecoration(color: Colors.blue.withOpacity(0.4),borderRadius: 4.borderRadius),
                            padding: EdgeInsets.symmetric(horizontal: 8,vertical: 3)
                        )).toList(),
                      ),
                      SizedBox(height: 12,)
                    ]
                ],
              ),
            ],
          ).addToContainer(
              decoration: BoxDecoration(
                color: Colors.white,
              ),
              padding: EdgeInsets.symmetric(horizontal: 12)),
          SizedBox(
            height: 12,
          ),
          Column(
            children: [
              Container(),
              TitleValueWidget(
                  title: '造成药物异常可能因素（可复选）',
                  value: '',
                  hint: '',
                  contentWeight: -1,
                  isRequired: false,
                  padding: EdgeInsets.zero),
              CheckTextItem(
                title: '与工作状态/流程有关',
                onChanged: (value) {
                  detail?.qualityAnomalousEvent?.isProcessFactor = value?1:0;
                },
                defaultSelected:
                detail?.qualityAnomalousEvent?.isProcessFactor == 1,
              ),
              NoBorderInput(text: detail?.qualityAnomalousEvent?.processFactor ?? "",onChanged: (str){
                detail?.qualityAnomalousEvent?.processFactor  = str;
              },hintText: '请输入')
                  .addToContainer(
                  width: double.infinity,
                  decoration: BoxDecoration(
                      color: Colours.bg_color,
                      borderRadius: 3.borderRadius),
                  padding:
                  EdgeInsets.symmetric(horizontal: 16, vertical: 11)),
              CheckTextItem(
                title: '与设备器材/药品因素有关',
                onChanged: (value) {
                  detail?.qualityAnomalousEvent?.isDeviceDrugFactor = value?1:0;
                },
                defaultSelected:
                detail?.qualityAnomalousEvent?.isDeviceDrugFactor == 1,
              ),
              NoBorderInput( text:detail?.qualityAnomalousEvent?.deviceDrugFactor?? "",onChanged: (str){
                detail?.qualityAnomalousEvent?.deviceDrugFactor = str;
              },hintText: '请输入')
                  .addToContainer(
                  width: double.infinity,
                  decoration: BoxDecoration(
                      color: Colours.bg_color,
                      borderRadius: 3.borderRadius),
                  padding:
                  EdgeInsets.symmetric(horizontal: 16, vertical: 11)),
              CheckTextItem(
                title: '与环境因素有关',
                onChanged: (value) {
                  detail?.qualityAnomalousEvent?.isEnvirnmentFactor = value?1:0;
                },
                defaultSelected:
                detail?.qualityAnomalousEvent?.isEnvirnmentFactor == 1,
              ),
              NoBorderInput(text:detail?.qualityAnomalousEvent?.deviceDrugFactor ?? "",onChanged: (str){
                detail?.qualityAnomalousEvent?.deviceDrugFactor = str;
              },hintText: '请输入')
                  .addToContainer(
                  width: double.infinity,
                  decoration: BoxDecoration(
                      color: Colours.bg_color,
                      borderRadius: 3.borderRadius),
                  padding:
                  EdgeInsets.symmetric(horizontal: 16, vertical: 11)),
              CheckTextItem(
                title: '与人员因素有关',
                onChanged: (value) {
                  detail?.qualityAnomalousEvent?.isPersonnelFactor = value?1:0;
                },
                defaultSelected:
                detail?.qualityAnomalousEvent?.isPersonnelFactor == 1,
              ),
              NoBorderInput(text:detail?.qualityAnomalousEvent?.personnelFactor ?? "",onChanged: (str){
                detail?.qualityAnomalousEvent?.personnelFactor = str;
              },hintText: '请输入')
                  .addToContainer(
                  width: double.infinity,
                  decoration: BoxDecoration(
                      color: Colours.bg_color,
                      borderRadius: 3.borderRadius),
                  padding:
                  EdgeInsets.symmetric(horizontal: 16, vertical: 11)),
              CheckTextItem(
                title: '与沟通因素有关',
                onChanged: (value) {
                  detail?.qualityAnomalousEvent?.isCommunicationFactor = value?1:0;
                },
                
                defaultSelected:
                detail?.qualityAnomalousEvent?.isCommunicationFactor == 1,
              ),
              NoBorderInput(
                  text:detail?.qualityAnomalousEvent?.communicationFactor ?? "",onChanged: (str){
                detail?.qualityAnomalousEvent?.communicationFactor = str;
              },hintText: '请输入')
                  .addToContainer(
                  width: double.infinity,
                  decoration: BoxDecoration(
                      color: Colours.bg_color,
                      borderRadius: 3.borderRadius),
                  padding:
                  EdgeInsets.symmetric(horizontal: 16, vertical: 11)),
              CheckTextItem(
                title: '与长者生理/疾病/行为因素有关',
                onChanged: (value) {
                  detail?.qualityAnomalousEvent?.isElderHealthFactor = value?1:0;
                },
                
                defaultSelected:
                detail?.qualityAnomalousEvent?.isElderHealthFactor == 1,
              ),
              NoBorderInput(text:detail?.qualityAnomalousEvent?.elderHealthFactor ?? "",onChanged: (str){
                detail?.qualityAnomalousEvent?.elderHealthFactor = str;
              },hintText: '请输入')
                  .addToContainer(
                  width: double.infinity,
                  decoration: BoxDecoration(
                      color: Colours.bg_color,
                      borderRadius: 3.borderRadius),
                  padding:
                  EdgeInsets.symmetric(horizontal: 16, vertical: 11)),
              CheckTextItem(
                title: '与机构政策及管理因素有关',
                onChanged: (value) {
                  detail
                      ?.qualityAnomalousEvent?.isMechanismManagermentFactor =value?1:0;
                },
                
                defaultSelected: detail
                    ?.qualityAnomalousEvent?.isMechanismManagermentFactor ==
                    1,
              ),
              NoBorderInput(text:detail
                  ?.qualityAnomalousEvent?.mechanismManagermentFactor ??
                  "",onChanged: (str){
                detail
                    ?.qualityAnomalousEvent?.mechanismManagermentFactor = str;
              },hintText: '请输入')
                  .addToContainer(
                  width: double.infinity,
                  decoration: BoxDecoration(
                      color: Colours.bg_color,
                      borderRadius: 3.borderRadius),
                  padding:
                  EdgeInsets.symmetric(horizontal: 16, vertical: 11)),
              Container()
            ].insertWidget(SizedBox(
              height: 16,
            )),
          ).addToContainer(
              decoration: BoxDecoration(
                color: Colors.white,
              ),
              padding: EdgeInsets.symmetric(horizontal: 12)),
          SizedBox(
            height: 12,
          ),
          Column(
            children: [
              TitleValueWidget(
                  title: '给药异常事件造成的结果',
                  value: detail?.qualityAnomalousEvent?.abnormalResult
                      ?.comboDataName((viewModel.comboListMap['60'] ?? [])),
                  hint: '',
                  contentWeight: 1,
                  isRequired: false,
                  arrow: arrowRight).onTap(() {
                    viewModel.chooseComboInfo(code: '60', onApply: (item){
                      setState(() {
                        detail?.qualityAnomalousEvent?.abnormalResult = num.tryParse(item.codeValue!);
                      });
                    });
              }),
            ],
          ).addToContainer(
              decoration: BoxDecoration(
                color: Colors.white,
              ),
              padding: EdgeInsets.symmetric(horizontal: 12)),
          SizedBox(
            height: 12,
          ),
          Column(
            children: [
              Container(),
              TitleValueWidget(
                  title: '改善方案',
                  value: '',
                  hint: '',
                  contentWeight: -1,
                  isRequired: false,
                  padding: EdgeInsets.zero),
              Row(
                children: [
                  CheckTextItem(
                    title: '长者及家属教育',
                    onChanged: (value) {
                      detail?.qualityAnomalousEvent?.isElderRelationEdu = value?1:0;
                    },
                    
                    defaultSelected:
                    detail?.qualityAnomalousEvent?.isElderRelationEdu == 1,
                  ).setWeight(1),
                  CommonText(
                      detail?.qualityAnomalousEvent?.elderRelationEduTime).onTap(() {
                        viewModel.chooseTime(detail?.qualityAnomalousEvent?.elderRelationEduTime, (dateTime) {
                          setState(() {
                            detail?.qualityAnomalousEvent?.elderRelationEduTime = dateTime;
                          });
                        });
                  })
                ],
              ),
              NoBorderInput(text:detail?.qualityAnomalousEvent?.elderRelationEdu ?? "",onChanged: (str){
                detail?.qualityAnomalousEvent?.elderRelationEdu = str;
              },hintText: '请输入')
                  .addToContainer(
                  width: double.infinity,
                  decoration: BoxDecoration(
                      color: Colours.bg_color,
                      borderRadius: 3.borderRadius),
                  padding:
                  EdgeInsets.symmetric(horizontal: 16, vertical: 11)),
              Row(
                children: [
                  CheckTextItem(
                    title: '护理人员教育',
                    onChanged: (value) {
                      detail?.qualityAnomalousEvent?.isNurseEdu = value?1:0;
                    },
                    
                    defaultSelected:
                    detail?.qualityAnomalousEvent?.isNurseEdu == 1,
                  ).setWeight(1),
                  CommonText(detail?.qualityAnomalousEvent?.nurseEduTime).onTap(() {
                    viewModel.chooseTime(detail?.qualityAnomalousEvent?.nurseEduTime, (dateTime) {
                      setState(() {
                        detail?.qualityAnomalousEvent?.nurseEduTime = dateTime;
                      });
                    });
                  })
                ],
              ),
              NoBorderInput(text:detail?.qualityAnomalousEvent?.nurseEdu ?? "",onChanged: (str){
                detail?.qualityAnomalousEvent?.nurseEdu = str;
              },hintText: '请输入')
                  .addToContainer(
                  width: double.infinity,
                  decoration: BoxDecoration(
                      color: Colours.bg_color,
                      borderRadius: 3.borderRadius),
                  padding:
                  EdgeInsets.symmetric(horizontal: 16, vertical: 11)),
              Row(
                children: [
                  CheckTextItem(
                    title: '修正护理照护计划',
                    onChanged: (value) {
                      detail?.qualityAnomalousEvent?.isAmendNursePaln = value?1:0;
                    },
                    
                    defaultSelected:
                    detail?.qualityAnomalousEvent?.isAmendNursePaln == 1,
                  ).setWeight(1),
                  CommonText(detail?.qualityAnomalousEvent?.amendNursePalnTime).onTap(() {
                    viewModel.chooseTime(detail?.qualityAnomalousEvent?.amendNursePalnTime, (dateTime) {
                      setState(() {
                        detail?.qualityAnomalousEvent?.amendNursePalnTime = dateTime;
                      });
                    });
                  })
                ],
              ),
              NoBorderInput(text:detail?.qualityAnomalousEvent?.amendNursePaln ?? "",onChanged: (str){
                detail?.qualityAnomalousEvent?.amendNursePaln = str;
              },hintText: '请输入')
                  .addToContainer(
                  width: double.infinity,
                  decoration: BoxDecoration(
                      color: Colours.bg_color,
                      borderRadius: 3.borderRadius),
                  padding:
                  EdgeInsets.symmetric(horizontal: 16, vertical: 11)),
              Row(
                children: [
                  CheckTextItem(
                    title: '与环境因素有关',
                    onChanged: (value) {
                      detail?.qualityAnomalousEvent?.isEnvirnmentFactor = value?1:0;
                    },
                    defaultSelected:
                    detail?.qualityAnomalousEvent?.isEnvirnmentFactor == 1,
                  ).setWeight(1),
                  CommonText(
                      detail?.qualityAnomalousEvent?.envirnmentFactorTime).onTap(() {
                    viewModel.chooseTime(detail?.qualityAnomalousEvent?.envirnmentFactorTime, (dateTime) {
                      setState(() {
                        detail?.qualityAnomalousEvent?.envirnmentFactorTime = dateTime;
                      });
                    });
                  })
                ],
              ),
              NoBorderInput(text:detail?.qualityAnomalousEvent?.envirnmentFactor ?? "",onChanged: (str){
                detail?.qualityAnomalousEvent?.envirnmentFactor = str;
              },hintText: '请输入')
                  .addToContainer(
                  width: double.infinity,
                  decoration: BoxDecoration(
                      color: Colours.bg_color,
                      borderRadius: 3.borderRadius),
                  padding:
                  EdgeInsets.symmetric(horizontal: 16, vertical: 11)),
              CheckTextItem(
                title: '增强长者观察',
                onChanged: (value) {
                  detail?.qualityAnomalousEvent?.isObservationInterval = value?1:0;
                },
                defaultSelected:
                detail?.qualityAnomalousEvent?.isObservationInterval == 1,
              ),
              Row(
                children: [
                  CommonText('原检查时间（小时）',
                      textColor: Colours.gray_99, textSize: 15)
                      .setWeight(2),
                  NoBorderInput(text:detail?.qualityAnomalousEvent
                      ?.observationOriginalInterval.toStringOrNull()??"",onChanged: (str){
                    detail?.qualityAnomalousEvent
                        ?.observationOriginalInterval = num.tryParse(str);
                  },keyboardType: CommonInputType.numberAndDecimal,hintText: '请输入')
                      .addToContainer(
                      width: double.infinity,
                      decoration: BoxDecoration(
                          color: Colours.bg_color,
                          borderRadius: 3.borderRadius),
                      padding: EdgeInsets.symmetric(
                          horizontal: 16, vertical: 11))
                      .setWeight(3)
                ],
              ),
              Row(
                children: [
                  CommonText(
                    '改为',
                    textColor: Colours.gray_99,
                    textSize: 15,
                  ).setWeight(2),
                  NoBorderInput(text:detail
                      ?.qualityAnomalousEvent?.observationNewInterval.toStringOrNull()??"",onChanged: (str){
                    detail
                        ?.qualityAnomalousEvent?.observationNewInterval = num.tryParse(str);
                  },keyboardType: CommonInputType.numberAndDecimal,hintText: '请输入')

                      .addToContainer(
                      width: double.infinity,
                      decoration: BoxDecoration(
                          color: Colours.bg_color,
                          borderRadius: 3.borderRadius),
                      padding: EdgeInsets.symmetric(
                          horizontal: 16, vertical: 11))
                      .setWeight(3)
                ],
              ),
              Row(
                children: [
                  CheckTextItem(
                    title: '其他',
                    onChanged: (value) {
                      detail?.qualityAnomalousEvent?.isOtherImprovement = value?1:0;
                    },
                    
                    defaultSelected:
                    detail?.qualityAnomalousEvent?.isOtherImprovement == 1,
                  ).setWeight(1),
                  CommonText(
                      detail?.qualityAnomalousEvent?.otherImprovementTime).onTap(() {
                    viewModel.chooseTime(detail?.qualityAnomalousEvent?.otherImprovementTime, (dateTime) {
                      setState(() {
                        detail?.qualityAnomalousEvent?.otherImprovementTime = dateTime;
                      });
                    });
                  })
                ],
              ),
              NoBorderInput(text:detail?.qualityAnomalousEvent?.otherImprovement ?? "",onChanged: (str){
                detail?.qualityAnomalousEvent?.otherImprovement= str;
              },hintText: '请输入')
                  .addToContainer(
                  width: double.infinity,
                  decoration: BoxDecoration(
                      color: Colours.bg_color,
                      borderRadius: 3.borderRadius),
                  padding:
                  EdgeInsets.symmetric(horizontal: 16, vertical: 11)),
              Container()
            ].insertWidget(SizedBox(
              height: 16,
            )),
          ).addToContainer(
              decoration: BoxDecoration(
                color: Colors.white,
              ),
              padding: EdgeInsets.symmetric(horizontal: 12)),

          // SizedBox(
          //   height: 12,
          // ),
          // CheckWithText(
          //   title: '是否生成交接班',
          //   onChanged: (value) {
          //     detail?.qualityAnomalousEvent?.generateShiftInformation = value?1:0;
          //   },
          //   textStyle: TextStyle(color: Colours.text_dark),defaultSelected: detail?.qualityAnomalousEvent?.generateShiftInformation==1,
          // ).addToContainer(
          //     width: double.infinity,
          //     decoration: BoxDecoration(
          //       color: Colors.white,
          //     ),
          //     padding: EdgeInsets.symmetric(horizontal: 12, vertical: 12)),
          SizedBox(
            height: 24,
          ),
          TextButton(
            onPressed: () {
              viewModel.submitSave();
            },
            child: CommonText('保存', textColor: Colors.white),
            style: badEventButtonStyle,
          ).addToContainer(
            margin: EdgeInsets.symmetric(horizontal: 12),
          ),
          SizedBox(
            height: 34,
          )
        ],
      ),
    );
  }

  Widget get arrowRight => Icon(
        Icons.keyboard_arrow_right,
        size: 15,
        color: Colours.gray_99,
      );

  @override
  Widget buildRootView(BuildContext context, Widget loadingContentWidget) {
    var type = vm?.eventDetail?.eventType;
    var name = type==1?'跌倒事件':type==4?'药品分发事件':type==5?'其他异常':'';
    return Scaffold(
      backgroundColor: Colours.bg_color,
      appBar: AppBar(
        title: Text(name.isNullOrEmpty()?'不良事件':'不良事件-${name}'),
      ),
      body: loadingContentWidget,
    );
  }

  @override
  CreateBadEventViewModel createViewModel() {
    return CreateBadEventViewModel(context,eventType: widget.eventType,eventId: widget.eventId,);
  }

  @override
  void onRetryClick() {}
}
